from django.db import models
from django.utils.translation import gettext_lazy as _

class Department(models.Model):
    """部门管理模型"""
    name = models.CharField(_('部门名称'), max_length=100)
    code = models.CharField(_('部门代码'), max_length=50, unique=True)
    description = models.TextField(_('描述'), null=True, blank=True)
    is_active = models.BooleanField(_('是否启用'), default=True)
    created_at = models.DateTimeField(_('创建时间'), auto_now_add=True)
    updated_at = models.DateTimeField(_('更新时间'), auto_now=True)

    class Meta:
        verbose_name = _('部门')
        verbose_name_plural = _('部门')
        ordering = ['code']

    def __str__(self):
        return self.name 